<?php
	if( !function_exists('__autoload') )
	{
    	function __autoload($class_name) {
    		require_once $class_name . '.php';
    	}
	}
	
	if(isset($_GET['cod'])){
		$planoInterno = new PlanoInterno();
		if($planoInterno->ConsultarReservaAssociada($_GET['cod'])){
			$erro = "Erro na exclusão do plano interno: Existe reserva associada a esse plano!";
			header("Location: BuscarPlanoInterno.php?erro=$erro");
		}else{
			$planoInterno->ExcluirPorCod($_GET['cod']);
			header("Location: BuscarPlanoInterno.php");
		}
	}
	
	header("Location: BuscarPlanoInterno.php");
?>